﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace OpenGameEngine.Input
{
    /// <summary>
    /// Tracks the state of each key on the keyboard.
    /// </summary>
    public class KeyboardStateInfo : Object
    {
        private bool _disposed;

        private bool None;
        private bool LButton;
        private bool RButton;
        private bool Cancel;
        private bool MButton;
        private bool XButton1;
        private bool XButton2;
        private bool Back;
        private bool Tab;
        private bool LineFeed;
        private bool Clear;
        private bool Enter;
        private bool Return;
        private bool ShiftKey;
        private bool ControlKey;
        private bool Menu;
        private bool Pause;
        private bool CapsLock;
        private bool Capital;
        private bool HangulMode;
        private bool HanguelMode;
        private bool KanaMode;
        private bool JunjaMode;
        private bool FinalMode;
        private bool KanjiMode;
        private bool HanjaMode;
        private bool Escape;
        private bool IMEConvert;
        private bool IMENonconvert;
        private bool IMEAccept;
        private bool IMEAceept;
        private bool IMEModeChange;
        private bool Space;
        private bool Prior;
        private bool PageUp;
        private bool PageDown;
        private bool Next;
        private bool End;
        private bool Home;
        private bool Left;
        private bool Up;
        private bool Right;
        private bool Down;
        private bool Select;
        private bool Print;
        private bool Execute;
        private bool Snapshot;
        private bool PrintScreen;
        private bool Insert;
        private bool Delete;
        private bool Help;
        private bool D0;
        private bool D1;
        private bool D2;
        private bool D3;
        private bool D4;
        private bool D5;
        private bool D6;
        private bool D7;
        private bool D8;
        private bool D9;
        private bool A;
        private bool B;
        private bool C;
        private bool D;
        private bool E;
        private bool F;
        private bool G;
        private bool H;
        private bool I;
        private bool J;
        private bool K;
        private bool L;
        private bool M;
        private bool N;
        private bool O;
        private bool P;
        private bool Q;
        private bool R;
        private bool S;
        private bool T;
        private bool U;
        private bool V;
        private bool W;
        private bool X;
        private bool Y;
        private bool Z;
        private bool LWin;
        private bool RWin;
        private bool Apps;
        private bool Sleep;
        private bool NumPad0;
        private bool NumPad1;
        private bool NumPad2;
        private bool NumPad3;
        private bool NumPad4;
        private bool NumPad5;
        private bool NumPad6;
        private bool NumPad7;
        private bool NumPad8;
        private bool NumPad9;
        private bool Multiply;
        private bool Add;
        private bool Separator;
        private bool Subtract;
        private bool Decimal;
        private bool Divide;
        private bool F1;
        private bool F2;
        private bool F3;
        private bool F4;
        private bool F5;
        private bool F6;
        private bool F7;
        private bool F8;
        private bool F9;
        private bool F10;
        private bool F11;
        private bool F12;
        private bool F13;
        private bool F14;
        private bool F15;
        private bool F16;
        private bool F17;
        private bool F18;
        private bool F19;
        private bool F20;
        private bool F21;
        private bool F22;
        private bool F23;
        private bool F24;
        private bool NumLock;
        private bool Scroll;
        private bool LShiftKey;
        private bool RShiftKey;
        private bool LControlKey;
        private bool RControlKey;
        private bool LMenu;
        private bool RMenu;
        private bool BrowserBack;
        private bool BrowserForward;
        private bool BrowserRefresh;
        private bool BrowserStop;
        private bool BrowserSearch;
        private bool BrowserFavorites;
        private bool BrowserHome;
        private bool VolumeMute;
        private bool VolumeDown;
        private bool VolumeUp;
        private bool MediaNextTrack;
        private bool MediaPreviousTrack;
        private bool MediaStop;
        private bool MediaPlayPause;
        private bool LaunchMail;
        private bool SelectMedia;
        private bool LaunchApplication1;
        private bool LaunchApplication2;
        private bool OemSemicolon;
        private bool Oem1;
        private bool Oemplus;
        private bool Oemcomma;
        private bool OemMinus;
        private bool OemPeriod;
        private bool Oem2;
        private bool OemQuestion;
        private bool Oem3;
        private bool Oemtilde;
        private bool Oem4;
        private bool OemOpenBrackets;
        private bool OemPipe;
        private bool Oem5;
        private bool OemCloseBrackets;
        private bool Oem6;
        private bool OemQuotes;
        private bool Oem7;
        private bool Oem8;
        private bool Oem102;
        private bool OemBackslash;
        private bool ProcessKey;
        private bool Packet;
        private bool Attn;
        private bool Crsel;
        private bool Exsel;
        private bool EraseEof;
        private bool Play;
        private bool Zoom;
        private bool NoName;
        private bool Pa1;
        private bool OemClear;
        private bool KeyCode;
        private bool Shift;
        private bool Control;
        private bool Alt;

        private bool Modifiers;
        /// <summary>
        /// Gets the pressed-state for the specified keyboard key.
        /// </summary>
        /// <param name="key">The keyboard key whose state should be returned.</param>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        public bool this[Keys key]
        {
            get
            {
                //System.Reflection.FieldInfo field = null;
                //// String getName = Enum.GetName(typeof(Keys), key);
                //String keyName = key.ToString();
                //field = this.GetType().GetField(keyName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                //Object fieldVal = field.GetValue(this);
                //Boolean b = Convert.ToBoolean(fieldVal);
                //return b;
                return GetKey(key);
            }
            set 
            {
                SetKey(key, value);
            }
        }

        private bool GetKey(Keys key) 
        {
            switch (key)
            {
                case Keys.PrintScreen:
                    return PrintScreen;
                    
                case Keys.OemSemicolon:
                    return OemSemicolon;
                    
                case Keys.Prior:
                    return Prior;
                    
                case Keys.CapsLock:
                    return CapsLock;
                    
                case Keys.PageDown:
                    return PageDown;
                    
                case Keys.Return:
                    return Return;
                    
                case Keys.None:
                    return None;
                    
                case Keys.LButton:
                    return LButton;
                    
                case Keys.RButton:
                    return RButton;
                    
                case Keys.Cancel:
                    return Cancel;
                    
                case Keys.MButton:
                    return MButton;
                    
                case Keys.XButton1:
                    return XButton1;
                    
                case Keys.XButton2:
                    return XButton2;
                    
                case Keys.Back:
                    return Back;
                    
                case Keys.Tab:
                    return Tab;
                    
                case Keys.LineFeed:
                    return LineFeed;
                    
                case Keys.Clear:
                    return Clear;
                    
                case Keys.ShiftKey:
                    return ShiftKey;
                    
                case Keys.ControlKey:
                    return ControlKey;
                    
                case Keys.Menu:
                    return Menu;
                    
                case Keys.Pause:
                    return Pause;
                    
                case Keys.HanguelMode:
                    return HanguelMode;
                    
                case Keys.HanjaMode:
                    return HanjaMode;
                    
                case Keys.JunjaMode:
                    return JunjaMode;
                    
                case Keys.FinalMode:
                    return FinalMode;
                    
                case Keys.IMEAceept:
                    return IMEAceept;
                    
                case Keys.Escape:
                    return Escape;
                    
                case Keys.IMEConvert:
                    return IMEConvert;
                    
                case Keys.IMENonconvert:
                    return IMENonconvert;
                    
                case Keys.IMEModeChange:
                    return IMEModeChange;
                    
                case Keys.Space:
                    return Space;
                    
                case Keys.End:
                    return End;
                    
                case Keys.Home:
                    return Home;
                    
                case Keys.Left:
                    return Left;
                    
                case Keys.Up:
                    return Up;
                    
                case Keys.Right:
                    return Right;
                    
                case Keys.Down:
                    return Down;
                    
                case Keys.Select:
                    return Select;
                    
                case Keys.Print:
                    return Print;
                    
                case Keys.Execute:
                    return Execute;
                    
                case Keys.Insert:
                    return Insert;
                    
                case Keys.Delete:
                    return Delete;
                    
                case Keys.Help:
                    return Help;
                    
                case Keys.D0:
                    return D0;
                    
                case Keys.D1:
                    return D1;
                    
                case Keys.D2:
                    return D2;
                    
                case Keys.D3:
                    return D3;
                    
                case Keys.D4:
                    return D4;
                    
                case Keys.D5:
                    return D5;
                    
                case Keys.D6:
                    return D6;
                    
                case Keys.D7:
                    return D7;
                    
                case Keys.D8:
                    return D8;
                    
                case Keys.D9:
                    return D9;
                    
                case Keys.A:
                    return A;
                    
                case Keys.B:
                    return B;
                    
                case Keys.C:
                    return C;
                    
                case Keys.D:
                    return D;
                    
                case Keys.E:
                    return E;
                    
                case Keys.F:
                    return F;
                    
                case Keys.G:
                    return G;
                    
                case Keys.H:
                    return H;
                    
                case Keys.I:
                    return I;
                    
                case Keys.J:
                    return J;
                    
                case Keys.K:
                    return K;
                    
                case Keys.L:
                    return L;
                    
                case Keys.M:
                    return M;
                    
                case Keys.N:
                    return N;
                    
                case Keys.O:
                    return O;
                    
                case Keys.P:
                    return P;
                    
                case Keys.Q:
                    return Q;
                    
                case Keys.R:
                    return R;
                    
                case Keys.S:
                    return S;
                    
                case Keys.T:
                    return T;
                    
                case Keys.U:
                    return U;
                    
                case Keys.V:
                    return V;
                    
                case Keys.W:
                    return W;
                    
                case Keys.X:
                    return X;
                    
                case Keys.Y:
                    return Y;
                    
                case Keys.Z:
                    return Z;
                    
                case Keys.LWin:
                    return LWin;
                    
                case Keys.RWin:
                    return RWin;
                    
                case Keys.Apps:
                    return Apps;
                    
                case Keys.Sleep:
                    return Sleep;
                    
                case Keys.NumPad0:
                    return NumPad0;
                    
                case Keys.NumPad1:
                    return NumPad1;
                    
                case Keys.NumPad2:
                    return NumPad2;
                    
                case Keys.NumPad3:
                    return NumPad3;
                    
                case Keys.NumPad4:
                    return NumPad4;
                    
                case Keys.NumPad5:
                    return NumPad5;
                    
                case Keys.NumPad6:
                    return NumPad6;
                    
                case Keys.NumPad7:
                    return NumPad7;
                    
                case Keys.NumPad8:
                    return NumPad8;
                    
                case Keys.NumPad9:
                    return NumPad9;
                    
                case Keys.Multiply:
                    return Multiply;
                    
                case Keys.Add:
                    return Add;
                    
                case Keys.Separator:
                    return Separator;
                    
                case Keys.Subtract:
                    return Subtract;
                    
                case Keys.Decimal:
                    return Decimal;
                    
                case Keys.Divide:
                    return Divide;
                    
                case Keys.F1:
                    return F1;
                    
                case Keys.F2:
                    return F2;
                    
                case Keys.F3:
                    return F3;
                    
                case Keys.F4:
                    return F4;
                    
                case Keys.F5:
                    return F5;
                    
                case Keys.F6:
                    return F6;
                    
                case Keys.F7:
                    return F7;
                    
                case Keys.F8:
                    return F8;
                    
                case Keys.F9:
                    return F9;
                    
                case Keys.F10:
                    return F10;
                    
                case Keys.F11:
                    return F11;
                    
                case Keys.F12:
                    return F12;
                    
                case Keys.F13:
                    return F13;
                    
                case Keys.F14:
                    return F14;
                    
                case Keys.F15:
                    return F15;
                    
                case Keys.F16:
                    return F16;
                    
                case Keys.F17:
                    return F17;
                    
                case Keys.F18:
                    return F18;
                    
                case Keys.F19:
                    return F19;
                    
                case Keys.F20:
                    return F20;
                    
                case Keys.F21:
                    return F21;
                    
                case Keys.F22:
                    return F22;
                    
                case Keys.F23:
                    return F23;
                    
                case Keys.F24:
                    return F24;
                    
                case Keys.NumLock:
                    return NumLock;
                    
                case Keys.Scroll:
                    return Scroll;
                    
                case Keys.LShiftKey:
                    return LShiftKey;
                    
                case Keys.RShiftKey:
                    return RShiftKey;
                    
                case Keys.LControlKey:
                    return LControlKey;
                    
                case Keys.RControlKey:
                    return RControlKey;
                    
                case Keys.LMenu:
                    return LMenu;
                    
                case Keys.RMenu:
                    return RMenu;
                    
                case Keys.BrowserBack:
                    return BrowserBack;
                    
                case Keys.BrowserForward:
                    return BrowserForward;
                    
                case Keys.BrowserRefresh:
                    return BrowserRefresh;
                    
                case Keys.BrowserStop:
                    return BrowserStop;
                    
                case Keys.BrowserSearch:
                    return BrowserSearch;
                    
                case Keys.BrowserFavorites:
                    return BrowserFavorites;
                    
                case Keys.BrowserHome:
                    return BrowserHome;
                    
                case Keys.VolumeMute:
                    return VolumeMute;
                    
                case Keys.VolumeDown:
                    return VolumeDown;
                    
                case Keys.VolumeUp:
                    return VolumeUp;
                    
                case Keys.MediaNextTrack:
                    return MediaNextTrack;
                    
                case Keys.MediaPreviousTrack:
                    return MediaPreviousTrack;
                    
                case Keys.MediaStop:
                    return MediaStop;
                    
                case Keys.MediaPlayPause:
                    return MediaPlayPause;
                    
                case Keys.LaunchMail:
                    return LaunchMail;
                    
                case Keys.SelectMedia:
                    return SelectMedia;
                    
                case Keys.LaunchApplication1:
                    return LaunchApplication1;
                    
                case Keys.LaunchApplication2:
                    return LaunchApplication2;
                    
                case Keys.Oemplus:
                    return Oemplus;
                    
                case Keys.Oemcomma:
                    return Oemcomma;
                    
                case Keys.OemMinus:
                    return OemMinus;
                    
                case Keys.OemPeriod:
                    return OemPeriod;
                    
                case Keys.Oem2:
                    return Oem2;
                    
                case Keys.Oem3:
                    return Oem3;
                    
                case Keys.Oem4:
                    return Oem4;
                    
                case Keys.OemPipe:
                    return OemPipe;
                    
                case Keys.OemCloseBrackets:
                    return OemCloseBrackets;
                    
                case Keys.OemQuotes:
                    return OemQuotes;
                    
                case Keys.Oem8:
                    return Oem8;
                    
                case Keys.Oem102:
                    return Oem102;
                    
                case Keys.ProcessKey:
                    return ProcessKey;
                    
                case Keys.Packet:
                    return Packet;
                    
                case Keys.Attn:
                    return Attn;
                    
                case Keys.Crsel:
                    return Crsel;
                    
                case Keys.Exsel:
                    return Exsel;
                    
                case Keys.EraseEof:
                    return EraseEof;
                    
                case Keys.Play:
                    return Play;
                    
                case Keys.Zoom:
                    return Zoom;
                    
                case Keys.NoName:
                    return NoName;
                    
                case Keys.Pa1:
                    return Pa1;
                    
                case Keys.OemClear:
                    return OemClear;
                    
                case Keys.KeyCode:
                    return KeyCode;
                    
                case Keys.Shift:
                    return Shift;
                    
                case Keys.Control:
                    return Control;
                    
                case Keys.Alt:
                    return Alt;
                    
                case Keys.Modifiers:
                    return Modifiers;
            }
            return false;
        }

        private void SetKey(Keys key, bool value)
        {
            switch (key)
            {
                case Keys.PrintScreen:
                    PrintScreen = value;
                    break;
                case Keys.OemSemicolon:
                    OemSemicolon = value;
                    break;
                case Keys.Prior:
                    Prior = value;
                    break;

                case Keys.CapsLock:
                    CapsLock = value;
                    break;
                case Keys.PageDown:
                    PageDown = value;
                    break;
                case Keys.Return:
                    Return = value;
                    Enter = value;
                    break;
                case Keys.None:
                    None = value;
                    break;
                case Keys.LButton:
                    LButton = value;
                    break;
                case Keys.RButton:
                    RButton = value;
                    break;
                case Keys.Cancel:
                    Cancel = value;
                    break;
                case Keys.MButton:
                    MButton = value;
                    break;
                case Keys.XButton1:
                    XButton1 = value;
                    break;
                case Keys.XButton2:
                    XButton2 = value;
                    break;
                case Keys.Back:
                    Back = value;
                    break;
                case Keys.Tab:
                    Tab = value;
                    break;
                case Keys.LineFeed:
                    LineFeed = value;
                    break;
                case Keys.Clear:
                    Clear = value;
                    break;
                case Keys.ShiftKey:
                    ShiftKey = value;
                    break;
                case Keys.ControlKey:
                    ControlKey = value;
                    break;
                case Keys.Menu:
                    Menu = value;
                    break;
                case Keys.Pause:
                    Pause = value;
                    break;
                case Keys.HanguelMode:
                    HanguelMode = value;
                    break;
                case Keys.HanjaMode:
                    HanjaMode = value;
                    break;
                case Keys.JunjaMode:
                    JunjaMode = value;
                    break;
                case Keys.FinalMode:
                    FinalMode = value;
                    break;
                case Keys.IMEAceept:
                    IMEAceept = value;
                    break;
                case Keys.Escape:
                    Escape = value;
                    break;
                case Keys.IMEConvert:
                    IMEConvert = value;
                    break;
                case Keys.IMENonconvert:
                    IMENonconvert = value;
                    break; 
                case Keys.IMEModeChange:
                    IMEModeChange = value;
                    break;
                case Keys.Space:
                    Space = value;
                    break;

                case Keys.End:
                    End = value;
                    break;
                case Keys.Home:
                    Home = value;
                    break;
                case Keys.Left:
                    Left = value;
                    break;
                case Keys.Up:
                    Up = value;
                    break;
                case Keys.Right:
                    Right = value;
                    break;
                case Keys.Down:
                    Down = value;
                    break;
                case Keys.Select:
                    Select = value;
                    break;
                case Keys.Print:
                    Print = value;
                    break;
                case Keys.Execute:
                    Execute = value;
                    break;
                case Keys.Insert:
                    Insert = value;
                    break;
                case Keys.Delete:
                    Delete = value;
                    break;
                case Keys.Help:
                    Help = value;
                    break;
                case Keys.D0:
                    D0 = value;
                    break;
                case Keys.D1:
                    D1 = value;
                    break;
                case Keys.D2:
                    D2 = value;
                    break;
                case Keys.D3:
                    D3 = value;
                    break;
                case Keys.D4:
                    D4 = value;
                    break;
                case Keys.D5:
                    D5 = value;
                    break;
                case Keys.D6:
                    D6 = value;
                    break;
                case Keys.D7:
                    D7 = value;
                    break;
                case Keys.D8:
                    D8 = value;
                    break;
                case Keys.D9:
                    D9 = value;
                    break;
                case Keys.A:
                    A = value;
                    break;
                case Keys.B:
                    B = value;
                    break;
                case Keys.C:
                    C = value;
                    break;
                case Keys.D:
                    D = value;
                    break;
                case Keys.E:
                    E = value;
                    break;
                case Keys.F:
                    F = value;
                    break;
                case Keys.G:
                    G = value;
                    break;
                case Keys.H:
                    H = value;
                    break;
                case Keys.I:
                    I = value;
                    break;
                case Keys.J:
                    J = value;
                    break;
                case Keys.K:
                    K = value;
                    break;
                case Keys.L:
                    L = value;
                    break;
                case Keys.M:
                    M = value;
                    break;
                case Keys.N:
                    N = value;
                    break;
                case Keys.O:
                    O = value;
                    break;
                case Keys.P:
                    P = value;
                    break;
                case Keys.Q:
                    Q = value;
                    break;
                case Keys.R:
                    R = value;
                    break;
                case Keys.S:
                    S = value;
                    break;
                case Keys.T:
                    T = value;
                    break;
                case Keys.U:
                    U = value;
                    break;
                case Keys.V:
                    V = value;
                    break;
                case Keys.W:
                    W = value;
                    break;
                case Keys.X:
                    X = value;
                    break;
                case Keys.Y:
                    Y = value;
                    break;
                case Keys.Z:
                    Z = value;
                    break;
                case Keys.LWin:
                    LWin = value;
                    break;
                case Keys.RWin:
                    RWin = value;
                    break;
                case Keys.Apps:
                    Apps = value;
                    break;
                case Keys.Sleep:
                    Sleep = value;
                    break;
                case Keys.NumPad0:
                    NumPad0 = value;
                    break;
                case Keys.NumPad1:
                    NumPad1 = value;
                    break;
                case Keys.NumPad2:
                    NumPad2 = value;
                    break;
                case Keys.NumPad3:
                    NumPad3 = value;
                    break;
                case Keys.NumPad4:
                    NumPad4 = value;
                    break;
                case Keys.NumPad5:
                    NumPad5 = value;
                    break;
                case Keys.NumPad6:
                    NumPad6 = value;
                    break;
                case Keys.NumPad7:
                    NumPad7 = value;
                    break;
                case Keys.NumPad8:
                    NumPad8 = value;
                    break;
                case Keys.NumPad9:
                    NumPad9 = value;
                    break;
                case Keys.Multiply:
                    Multiply = value;
                    break;
                case Keys.Add:
                    Add = value;
                    break;
                case Keys.Separator:
                    Separator = value;
                    break;
                case Keys.Subtract:
                    Subtract = value;
                    break;
                case Keys.Decimal:
                    Decimal = value;
                    break;
                case Keys.Divide:
                    Divide = value;
                    break;
                case Keys.F1:
                    F1 = value;
                    break;
                case Keys.F2:
                    F2 = value;
                    break;
                case Keys.F3:
                    F3 = value;
                    break;
                case Keys.F4:
                    F4 = value;
                    break;
                case Keys.F5:
                    F5 = value;
                    break;
                case Keys.F6:
                    F6 = value;
                    break;
                case Keys.F7:
                    F7 = value;
                    break;
                case Keys.F8:
                    F8 = value;
                    break;
                case Keys.F9:
                    F9 = value;
                    break;
                case Keys.F10:
                    F10 = value;
                    break;
                case Keys.F11:
                    F11 = value;
                    break;
                case Keys.F12:
                    F12 = value;
                    break;
                case Keys.F13:
                    F13 = value;
                    break;
                case Keys.F14:
                    F14 = value;
                    break;
                case Keys.F15:
                    F15 = value;
                    break;
                case Keys.F16:
                    F16 = value;
                    break;
                case Keys.F17:
                    F17 = value;
                    break;
                case Keys.F18:
                    F18 = value;
                    break;
                case Keys.F19:
                    F19 = value;
                    break;
                case Keys.F20:
                    F20 = value;
                    break;
                case Keys.F21:
                    F21 = value;
                    break;
                case Keys.F22:
                    F22 = value;
                    break;
                case Keys.F23:
                    F23 = value;
                    break;
                case Keys.F24:
                    F24 = value;
                    break;
                case Keys.NumLock:
                    NumLock = value;
                    break;
                case Keys.Scroll:
                    Scroll = value;
                    break;
                case Keys.LShiftKey:
                    LShiftKey = value;
                    break;
                case Keys.RShiftKey:
                    RShiftKey = value;
                    break;
                case Keys.LControlKey:
                    LControlKey = value;
                    break;
                case Keys.RControlKey:
                    RControlKey = value;
                    break;
                case Keys.LMenu:
                    LMenu = value;
                    break;
                case Keys.RMenu:
                    RMenu = value;
                    break;
                case Keys.BrowserBack:
                    BrowserBack = value;
                    break;
                case Keys.BrowserForward:
                    BrowserForward = value;
                    break;
                case Keys.BrowserRefresh:
                    BrowserRefresh = value;
                    break;
                case Keys.BrowserStop:
                    BrowserStop = value;
                    break;
                case Keys.BrowserSearch:
                    BrowserSearch = value;
                    break;
                case Keys.BrowserFavorites:
                    BrowserFavorites = value;
                    break;
                case Keys.BrowserHome:
                    BrowserHome = value;
                    break;
                case Keys.VolumeMute:
                    VolumeMute = value;
                    break;
                case Keys.VolumeDown:
                    VolumeDown = value;
                    break;
                case Keys.VolumeUp:
                    VolumeUp = value;
                    break;
                case Keys.MediaNextTrack:
                    MediaNextTrack = value;
                    break;
                case Keys.MediaPreviousTrack:
                    MediaPreviousTrack = value;
                    break;
                case Keys.MediaStop:
                    MediaStop = value;
                    break;
                case Keys.MediaPlayPause:
                    MediaPlayPause = value;
                    break;
                case Keys.LaunchMail:
                    LaunchMail = value;
                    break;
                case Keys.SelectMedia:
                    SelectMedia = value;
                    break;
                case Keys.LaunchApplication1:
                    LaunchApplication1 = value;
                    break;
                case Keys.LaunchApplication2:
                    LaunchApplication2 = value;
                    break;


                case Keys.Oemplus:
                    Oemplus = value;
                    break;
                case Keys.Oemcomma:
                    Oemcomma = value;
                    break;
                case Keys.OemMinus:
                    OemMinus = value;
                    break;
                case Keys.OemPeriod:
                    OemPeriod = value;
                    break;
                case Keys.Oem2:
                    Oem2 = value;
                    break;
                case Keys.Oem3:
                    Oem3 = value;
                    break;
                case Keys.Oem4:
                    Oem4 = value;
                    break;
                case Keys.OemPipe:
                    OemPipe = value;
                    break;
                case Keys.OemCloseBrackets:
                    OemCloseBrackets = value;
                    break;
                case Keys.OemQuotes:
                    OemQuotes = value;
                    break;
                case Keys.Oem8:
                    Oem8 = value;
                    break;
                case Keys.Oem102:
                    Oem102 = value;
                    break;
                case Keys.ProcessKey:
                    ProcessKey = value;
                    break;
                case Keys.Packet:
                    Packet = value;
                    break;
                case Keys.Attn:
                    Attn = value;
                    break;
                case Keys.Crsel:
                    Crsel = value;
                    break;
                case Keys.Exsel:
                    Exsel = value;
                    break;
                case Keys.EraseEof:
                    EraseEof = value;
                    break;
                case Keys.Play:
                    Play = value;
                    break;
                case Keys.Zoom:
                    Zoom = value;
                    break;
                case Keys.NoName:
                    NoName = value;
                    break;
                case Keys.Pa1:
                    Pa1 = value;
                    break;
                case Keys.OemClear:
                    OemClear = value;
                    break;
                case Keys.KeyCode:
                    KeyCode = value;
                    break;
                case Keys.Shift:
                    Shift = value;
                    break;
                case Keys.Control:
                    Control = value;
                    break;
                case Keys.Alt:
                    Alt = value;
                    break;
                case Keys.Modifiers:
                    Modifiers = value;
                    break;
            }
        }

        public KeyboardStateInfo Clone()
        {
            KeyboardStateInfo kbState = new KeyboardStateInfo();
            foreach (Keys k in Globals.KeyNames)
                kbState.SetKey(k, this.GetKey(k));

            return kbState;
        }
    }
}
